package net.mingsoft.config;

import springfox.documentation.swagger2.annotations.*;
import org.springframework.boot.autoconfigure.condition.*;
import org.springframework.beans.factory.annotation.*;
import springfox.documentation.spring.web.plugins.*;
import springfox.documentation.spi.*;
import org.springframework.context.annotation.*;
import springfox.documentation.service.*;
import springfox.documentation.builders.*;

@Configuration
@EnableSwagger2
@ConditionalOnProperty(prefix = "ms", name = { "swagger.enable" }, havingValue = "true")
public class SwaggerConfig
{
    @Value("${ms.swagger.enable:false}")
    private boolean enable;
    
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2).apiInfo(this.apiInfo()).enable(this.enable).select().apis(RequestHandlerSelectors.basePackage("net.mingsoft")).paths(PathSelectors.any()).build();
    }
    
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("api\u6587\u6863").description("restful \u98ce\u683c\u63a5\u53e3").version("1.0").build();
    }
}
